package com.paireach.bw.activity;

import android.os.Build;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.transition.Transition;
import android.transition.TransitionInflater;
import android.view.View;
import android.view.Window;
import android.widget.TextView;

import com.paireach.bw.R;

/**
 * Created by ${cqc} on 2017/1/17.
 */

public class AnswerActivity extends AppCompatActivity {

    private int position;
    private TextView tv_answer;
    private Toolbar toolbar;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (Build.VERSION.SDK_INT >= 21) {
            getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
            Transition bottom = TransitionInflater.from(this).inflateTransition(android.R.transition.slide_bottom);
            getWindow().setEnterTransition(bottom);
        }
        setContentView(R.layout.activity_answer);
        position = getIntent().getIntExtra("position", 0);

        findViews();
        initViews();
    }

    private void initViews() {
        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                onBackPressed();
            }
        });

        switch (position) {
            // 2,3问题去掉了
            case 0:
                tv_answer.setText(R.string.answer1);
                break;
            case 1:
                tv_answer.setText(R.string.answer2);
                break;
            case 2:
                tv_answer.setText(R.string.answer3);
                break;
            case 3:
                tv_answer.setText(R.string.answer4);
                break;
        }
    }

    private void findViews() {
        toolbar = (Toolbar) findViewById(R.id.toolbar_answer_activity);
        tv_answer = (TextView) findViewById(R.id.tv_answer);
    }
}
